const db = require("../../../libs/db");
const boom = require('boom');
const { generateToken } = require("../../utils/user-jwt");

const login = function (req, res, next) {
    // 演示程序模拟用户完成登录后把用户信息存入token，生成出来
    const tokenStr = generateToken({
        userId: 1,
        userName: 'admin',
        role: 'admin'
    })
    res.json({
        success: true,
        message: '登录成功',
        data: {
            token: tokenStr
        }
    })
    res.end()
}

module.exports = {
    login
}
